<template>
  <div class="app-container">
    <el-form :inline="true">
      <el-form-item>
        <el-input placeholder="待发编号" :clearable="true" type="number" size="mini">
          <template slot="prepend">待发编号</template>
        </el-input>
      </el-form-item>
      <el-form-item>
        <el-input placeholder="批号" :clearable="true" size="mini">
          <template slot="prepend">批号</template>
        </el-input>
      </el-form-item>
      <el-form-item>
        <el-input placeholder="品名" :clearable="true" size="mini">
          <template slot="prepend">品名</template>
        </el-input>
      </el-form-item>
      <el-form-item>
        <el-input placeholder="编码" :clearable="true" size="mini">
          <template slot="prepend">编码</template>
        </el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" class="pan-btn primary-btn" icon="el-icon-search" size="mini" @click="getDataList">搜索</el-button>
      </el-form-item>
    </el-form>

    <el-table :data="dataList" v-loading="dataListLoading" border fit highlight-current-row style="width: 100%">
      <el-table-column label="编号" prop="checkHalfId"></el-table-column>
      <el-table-column label="分类" prop="checkHalfId"></el-table-column>
      <el-table-column label="品名" prop="productName"></el-table-column>
      <el-table-column label="批号" prop="productGmp"></el-table-column>
      <el-table-column label="包装规格" prop="productPackSpec"></el-table-column>
      <el-table-column label="生产商" prop="manufacturerName"></el-table-column>
      <el-table-column label="供应商" prop="supplierName"></el-table-column>
      <el-table-column label="备注" prop="remark"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
         <el-button type="success" class="pan-btn success-btn" size="mini" @click="toCheck(scope.row)">请验</el-button>
        </template>
      </el-table-column>
    </el-table>

    <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="queryParams.pageIndex" :page-sizes="[10, 20, 50, 100]" :page-size="queryParams.pageSize" :total="dataTotal" layout="total, sizes, prev, pager, next, jumper"></el-pagination>

  </div>
</template>

<script>
  import {
    halfCheckList
  } from '@/api/wms'
  export default {
    name: 'half',
    components: {},
    data() {
      return {
        dataList: [],
        dataListLoading: false,
        queryParams:{
          status:0,
          checkHalfId:"",
          productName:"",
          productGmp:"",
          batchNum:"",
          pageIndex:1,
          pageSize:10
        },
        dataTotal:0
      }
    },
    mounted() {
      this.getDataList();
    },
    methods: {
      toCheck(row){
        this.$router.push({
          name: '待办请验单',
          params: {row: row}
        })
      },
      sizeChangeHandle(val){
        this.queryParams.pageSize = val
        this.queryParams.pageIndex = 1
        this.getDataList()
      },
      currentChangeHandle(val){
        this.pageIndex = val
        this.getDataList()
      },
      getDataList() {
        this.dataListLoading = true;
        halfCheckList(this.queryParams).then(res => {
          this.dataList = res.page.records;
          this.dataTotal = res.page.total;
          this.dataListLoading = false;
        }).catch();
      }
    }
  }
</script>

<style scoped>
  >>>.el-form-item__content {
    line-height: normal;
  }
</style>
